package com.laolei.core.kafka;

import java.io.Serializable;
import java.util.List;

import org.apache.kafka.clients.consumer.internals.PartitionAssignor;
import org.apache.kafka.common.serialization.Deserializer;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "spring.kafka.consumer")
public class ConsumerConfig implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 默认值: org.apache.kafka.common.serialization.StringDeserializer
	 */
	private Class<Deserializer<?>> keyDeserializer;
	/**
	 * 默认值: org.apache.kafka.common.serialization.ByteArrayDeserializer
	 */
	private Class<Deserializer<?>> valueDeserializer;
	/**
	 * 默认值:1
	 */
	private int fetchMinBytes = 1;
	/**
	 * 默认值:
	 */
	private String groupId;
	/**
	 * 默认值:3000
	 */
	private int heartbeatIntervalMs = 3000;
	/**
	 * 默认值:1048576
	 */
	private int maxPartitionFetchBytes = 1048576;
	/**
	 * 默认值:30000
	 */
	private int sessionTimeoutMs = 30000;

	/**
	 * 默认值:latest
	 */
	private String autoOffsetReset = "latest";
	/**
	 * 默认值:true
	 */
	private Boolean enableAutoCommit = true;
	/**
	 * 默认值:true
	 */
	private Boolean excludeInternalTopics = true;
	/**
	 * 默认值:2147483647
	 */
	private int maxPollRecords = 2147483647;
	/**
	 * 默认值:[org.apache.kafka.clients.consumer.RangeAssignor]
	 */
	private List<Class<PartitionAssignor>> partitionAssignmentStrategy;
	/**
	 * 默认值:5000
	 */
	private Integer autoCommitIntervalMs = 5000;
	/**
	 * 默认值:true
	 */
	private Boolean checkCrcs = true;
	/**
	 * 默认值:500
	 */
	private int fetchMaxWaitMs = 500;

	public Class<Deserializer<?>> getKeyDeserializer() {
		return keyDeserializer;
	}

	public void setKeyDeserializer(Class<Deserializer<?>> keyDeserializer) {
		this.keyDeserializer = keyDeserializer;
	}

	public Class<Deserializer<?>> getValueDeserializer() {
		return valueDeserializer;
	}

	public void setValueDeserializer(Class<Deserializer<?>> valueDeserializer) {
		this.valueDeserializer = valueDeserializer;
	}

	public int getFetchMinBytes() {
		return fetchMinBytes;
	}

	public void setFetchMinBytes(int fetchMinBytes) {
		this.fetchMinBytes = fetchMinBytes;
	}

	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	public int getHeartbeatIntervalMs() {
		return heartbeatIntervalMs;
	}

	public void setHeartbeatIntervalMs(int heartbeatIntervalMs) {
		this.heartbeatIntervalMs = heartbeatIntervalMs;
	}

	public int getMaxPartitionFetchBytes() {
		return maxPartitionFetchBytes;
	}

	public void setMaxPartitionFetchBytes(int maxPartitionFetchBytes) {
		this.maxPartitionFetchBytes = maxPartitionFetchBytes;
	}

	public int getSessionTimeoutMs() {
		return sessionTimeoutMs;
	}

	public void setSessionTimeoutMs(int sessionTimeoutMs) {
		this.sessionTimeoutMs = sessionTimeoutMs;
	}

	public String getAutoOffsetReset() {
		return autoOffsetReset;
	}

	public void setAutoOffsetReset(String autoOffsetReset) {
		this.autoOffsetReset = autoOffsetReset;
	}

	public Boolean getEnableAutoCommit() {
		return enableAutoCommit;
	}

	public void setEnableAutoCommit(Boolean enableAutoCommit) {
		this.enableAutoCommit = enableAutoCommit;
	}

	public Boolean getExcludeInternalTopics() {
		return excludeInternalTopics;
	}

	public void setExcludeInternalTopics(Boolean excludeInternalTopics) {
		this.excludeInternalTopics = excludeInternalTopics;
	}

	public int getMaxPollRecords() {
		return maxPollRecords;
	}

	public void setMaxPollRecords(int maxPollRecords) {
		this.maxPollRecords = maxPollRecords;
	}

	public List<Class<PartitionAssignor>> getPartitionAssignmentStrategy() {
		return partitionAssignmentStrategy;
	}

	public void setPartitionAssignmentStrategy(List<Class<PartitionAssignor>> partitionAssignmentStrategy) {
		this.partitionAssignmentStrategy = partitionAssignmentStrategy;
	}

	public Integer getAutoCommitIntervalMs() {
		return autoCommitIntervalMs;
	}

	public void setAutoCommitIntervalMs(Integer autoCommitIntervalMs) {
		this.autoCommitIntervalMs = autoCommitIntervalMs;
	}

	public Boolean getCheckCrcs() {
		return checkCrcs;
	}

	public void setCheckCrcs(Boolean checkCrcs) {
		this.checkCrcs = checkCrcs;
	}

	public int getFetchMaxWaitMs() {
		return fetchMaxWaitMs;
	}

	public void setFetchMaxWaitMs(int fetchMaxWaitMs) {
		this.fetchMaxWaitMs = fetchMaxWaitMs;
	}
}
